namespace KPIS.GERP.Models.Migrations
{
    using System;
    using System.Data.Entity.Migrations;
    
    public partial class update0028 : DbMigration
    {
        public override void Up()
        {
            //RenameTable(name: "dbo.MessageWarning", newName: "message_warning");
            //RenameTable(name: "dbo.HrmPsCommand", newName: "hrm_ps_commands");
            //RenameTable(name: "dbo.HrmPsCommandType", newName: "hrm_ps_command_types");
            //RenameTable(name: "dbo.HrmPsCommandGroup", newName: "hrm_ps_command_groups");
            //RenameTable(name: "dbo.HrmDcPenalty", newName: "hrm_dc_penalty");
            //RenameTable(name: "dbo.HrmPsCommandDtls", newName: "hrm_ps_command_dtls");
            //RenameTable(name: "dbo.HrmPsAbsence", newName: "hrm_ps_absence");
            //RenameTable(name: "dbo.HrmPsAbsenceType", newName: "hrm_ps_absence_types");
            //RenameTable(name: "dbo.HrmPsAbsenceRule", newName: "hrm_ps_absence_rules");
            //RenameTable(name: "dbo.HrmPsAbsenceTypeGroup", newName: "hrm_ps_absence_type_groups");
            //DropForeignKey("dbo.HrmPsCommand", "HrmPsCommandTypes_CmdTypeId", "dbo.HrmPsCommandType");
            //DropForeignKey("dbo.HrmPsCommand", "HrmPsEmployeeTypes_EmpTypeId", "dbo.hrm_ps_employee_types");
            //DropForeignKey("dbo.HrmPsCommand", "ApprovedId", "dbo.HrmPsCommand");
            //DropForeignKey("dbo.HrmPsEmployeeType", "YearTypeId", "dbo.sys_year_type");
            //DropIndex("dbo.HrmPsCommand", new[] { "HrmPsCommandTypes_CmdTypeId" });
            //DropIndex("dbo.HrmPsCommand", new[] { "HrmPsEmployeeTypes_EmpTypeId" });
            //DropIndex("dbo.HrmPsCommand", new[] { "ApprovedId" });
            //DropIndex("dbo.HrmPsEmployeeType", new[] { "YearTypeId" });
            // RenameColumn(table: "dbo.message_warning", name: "MessageId", newName: "message_seq");
            //RenameColumn(table: "dbo.message_warning", name: "MessageTh", newName: "message_th");
            //RenameColumn(table: "dbo.message_warning", name: "MessageEn", newName: "message_en");
            //RenameColumn(table: "dbo.message_warning", name: "MessageType", newName: "message_type");
            //RenameColumn(table: "dbo.message_warning", name: "RecordStatus", newName: "record_status");
            //RenameColumn(table: "dbo.message_warning", name: "CreatedBy", newName: "created_by");
            //RenameColumn(table: "dbo.message_warning", name: "CreatedWhen", newName: "created_when");
            //RenameColumn(table: "dbo.message_warning", name: "UpdatedBy", newName: "updated_by");
            //RenameColumn(table: "dbo.message_warning", name: "UpdatedWhen", newName: "updated_when");

            //RenameColumn(table: "dbo.hrm_ps_commands", name: "CmdId", newName: "cmd_seq");
            //RenameColumn(table: "dbo.hrm_ps_commands", name: "CmdFlag", newName: "cmd_flag");
            //RenameColumn(table: "dbo.hrm_ps_commands", name: "CmdDraftNo", newName: "cmd_draft_no");
            //RenameColumn(table: "dbo.hrm_ps_commands", name: "CmdName", newName: "cmd_name");
            //RenameColumn(table: "dbo.hrm_ps_commands", name: "CmdDescr", newName: "cmd_descr");
            //RenameColumn(table: "dbo.hrm_ps_commands", name: "CmdRefNo", newName: "cmd_ref_no");
            //RenameColumn(table: "dbo.hrm_ps_commands", name: "CmdTypeId", newName: "cmd_type_seq");
            //RenameColumn(table: "dbo.hrm_ps_commands", name: "EmpTypeId", newName: "emp_type_seq");
            //RenameColumn(table: "dbo.hrm_ps_commands", name: "JobSiteId", newName: "job_site_seq");
            //RenameColumn(table: "dbo.hrm_ps_commands", name: "PenaltyId", newName: "penalty_seq");
            //RenameColumn(table: "dbo.hrm_ps_commands", name: "CmdStatus", newName: "cmd_status");
            //RenameColumn(table: "dbo.hrm_ps_commands", name: "ApprovedName", newName: "approved_name");
            //RenameColumn(table: "dbo.hrm_ps_commands", name: "ApprovedPositions", newName: "approved_positions");
            //RenameColumn(table: "dbo.hrm_ps_commands", name: "ApprovedDate", newName: "approved_date");
            //RenameColumn(table: "dbo.hrm_ps_commands", name: "CmdRptDate", newName: "cmd_rpt_date");
            //RenameColumn(table: "dbo.hrm_ps_commands", name: "RptHeader", newName: "rpt_header");
            //RenameColumn(table: "dbo.hrm_ps_commands", name: "RecordStatus", newName: "record_status");
            //RenameColumn(table: "dbo.hrm_ps_commands", name: "CreatedBy", newName: "created_by");
            //RenameColumn(table: "dbo.hrm_ps_commands", name: "CreatedWhen", newName: "created_when");
            //RenameColumn(table: "dbo.hrm_ps_commands", name: "UpdatedBy", newName: "updated_by");
            //RenameColumn(table: "dbo.hrm_ps_commands", name: "UpdatedWhen", newName: "updated_when");

            //RenameColumn(table: "dbo.hrm_ps_command_types", name: "CmdTypeId", newName: "cmd_type_seq");
            //RenameColumn(table: "dbo.hrm_ps_command_types", name: "CmdTypeCode", newName: "cmd_type_code");
            //RenameColumn(table: "dbo.hrm_ps_command_types", name: "CmdTypeName", newName: "cmd_type_name");
            //RenameColumn(table: "dbo.hrm_ps_command_types", name: "CmdTypeNameShort", newName: "cmd_type_name_short");
            //RenameColumn(table: "dbo.hrm_ps_command_types", name: "CmdGroupId", newName: "cmd_group_seq");
            //RenameColumn(table: "dbo.hrm_ps_command_types", name: "RptFormat", newName: "rpt_format");
            //RenameColumn(table: "dbo.hrm_ps_command_types", name: "RecordStatus", newName: "record_status");
            //RenameColumn(table: "dbo.hrm_ps_command_types", name: "CreatedBy", newName: "created_by");
            //RenameColumn(table: "dbo.hrm_ps_command_types", name: "CreatedWhen", newName: "created_when");
            //RenameColumn(table: "dbo.hrm_ps_command_types", name: "UpdatedBy", newName: "updated_by");
            //RenameColumn(table: "dbo.hrm_ps_command_types", name: "UpdatedWhen", newName: "updated_when");
            //RenameColumn(table: "dbo.hrm_ps_command_types", name: "RptHeader", newName: "rpt_header");
            //RenameColumn(table: "dbo.hrm_ps_command_groups", name: "CmdGroupId", newName: "cmd_group_seq");
            //RenameColumn(table: "dbo.hrm_ps_command_groups", name: "CmdGroupName", newName: "cmd_group_name");
            //RenameColumn(table: "dbo.hrm_ps_command_groups", name: "RecordStatus", newName: "record_status");
            //RenameColumn(table: "dbo.hrm_ps_command_groups", name: "CreatedBy", newName: "created_by");
            //RenameColumn(table: "dbo.hrm_ps_command_groups", name: "CreatedWhen", newName: "created_when");
            //RenameColumn(table: "dbo.hrm_ps_command_groups", name: "UpdatedBy", newName: "updated_by");
            //RenameColumn(table: "dbo.hrm_ps_command_groups", name: "UpdatedWhen", newName: "updated_when");
            //RenameColumn(table: "dbo.hrm_dc_penalty", name: "PenId", newName: "pen_seq");
            //RenameColumn(table: "dbo.hrm_dc_penalty", name: "PenName", newName: "pen_name");
            //RenameColumn(table: "dbo.hrm_dc_penalty", name: "RecordStatus", newName: "record_status");
            //RenameColumn(table: "dbo.hrm_dc_penalty", name: "CreatedBy", newName: "created_by");
            //RenameColumn(table: "dbo.hrm_dc_penalty", name: "CreatedWhen", newName: "created_when");
            //RenameColumn(table: "dbo.hrm_dc_penalty", name: "UpdatedBy", newName: "updated_by");
            //RenameColumn(table: "dbo.hrm_dc_penalty", name: "UpdatedWhen", newName: "updated_when");
            //RenameColumn(table: "dbo.hrm_ps_command_dtls", name: "CmdDtlsId", newName: "cmd_dtls_seq");
            //RenameColumn(table: "dbo.hrm_ps_command_dtls", name: "CmdId", newName: "cmd_seq");
            //RenameColumn(table: "dbo.hrm_ps_command_dtls", name: "EmpId", newName: "emp_seq");
            //RenameColumn(table: "dbo.hrm_ps_command_dtls", name: "StartDate", newName: "start_date");
            //RenameColumn(table: "dbo.hrm_ps_command_dtls", name: "EndDate", newName: "end_date");
            //RenameColumn(table: "dbo.hrm_ps_command_dtls", name: "EduHisId", newName: "edu_his_seq");
            //RenameColumn(table: "dbo.hrm_ps_command_dtls", name: "RptRemarks", newName: "rpt_remarks");
            //RenameColumn(table: "dbo.hrm_ps_command_dtls", name: "MoveId", newName: "move_seq");
            //RenameColumn(table: "dbo.hrm_ps_command_dtls", name: "OldPosId", newName: "old_pos_seq");
            //RenameColumn(table: "dbo.hrm_ps_command_dtls", name: "OldPosRef", newName: "old_pos_ref");
            //RenameColumn(table: "dbo.hrm_ps_command_dtls", name: "OldPosName", newName: "old_pos_name");
            //RenameColumn(table: "dbo.hrm_ps_command_dtls", name: "OldExecPosName", newName: "old_exec_pos_name");
            //RenameColumn(table: "dbo.hrm_ps_command_dtls", name: "OldClassId", newName: "old_class_seq");
            //RenameColumn(table: "dbo.hrm_ps_command_dtls", name: "OldJobSiteId", newName: "old_job_site_seq");
            //RenameColumn(table: "dbo.hrm_ps_command_dtls", name: "OldJobSiteName", newName: "old_job_site_name");
            //RenameColumn(table: "dbo.hrm_ps_command_dtls", name: "OldWorkingJobSiteId", newName: "old_working_job_site_seq");
            //RenameColumn(table: "dbo.hrm_ps_command_dtls", name: "OldWorkingJobSiteName", newName: "old_working_job_site_name");
            //RenameColumn(table: "dbo.hrm_ps_command_dtls", name: "OldSalary", newName: "old_salary");
            //RenameColumn(table: "dbo.hrm_ps_command_dtls", name: "OldExecSalary", newName: "old_exec_salary");
            //RenameColumn(table: "dbo.hrm_ps_command_dtls", name: "OldPosLine", newName: "old_pos_line");
            //RenameColumn(table: "dbo.hrm_ps_command_dtls", name: "OldPosTypeId", newName: "old_pos_type_seq");
            //RenameColumn(table: "dbo.hrm_ps_command_dtls", name: "OldExecPosId", newName: "old_exec_pos_seq");
            //RenameColumn(table: "dbo.hrm_ps_command_dtls", name: "NewPosId", newName: "new_pos_seq");
            //RenameColumn(table: "dbo.hrm_ps_command_dtls", name: "NewPosRef", newName: "new_pos_ref");
            //RenameColumn(table: "dbo.hrm_ps_command_dtls", name: "NewPosName", newName: "new_pos_name");
            //RenameColumn(table: "dbo.hrm_ps_command_dtls", name: "NewExecPosName", newName: "new_exec_pos_name");
            //RenameColumn(table: "dbo.hrm_ps_command_dtls", name: "NewClassId", newName: "new_class_seq");
            //RenameColumn(table: "dbo.hrm_ps_command_dtls", name: "NewJobSiteId", newName: "new_job_site_seq");
            //RenameColumn(table: "dbo.hrm_ps_command_dtls", name: "NewJobSiteName", newName: "new_job_site_name");
            //RenameColumn(table: "dbo.hrm_ps_command_dtls", name: "NewWorkingJobSiteId", newName: "new_working_job_site_seq");
            //RenameColumn(table: "dbo.hrm_ps_command_dtls", name: "NewWorkingJobSiteName", newName: "new_working_job_site_name");
            //RenameColumn(table: "dbo.hrm_ps_command_dtls", name: "NewSalary", newName: "new_salary");
            //RenameColumn(table: "dbo.hrm_ps_command_dtls", name: "NewExecSalary", newName: "new_exec_salary");
            //RenameColumn(table: "dbo.hrm_ps_command_dtls", name: "NewPosLine", newName: "new_pos_line");
            //RenameColumn(table: "dbo.hrm_ps_command_dtls", name: "NewPosTypeId", newName: "new_pos_type_seq");
            //RenameColumn(table: "dbo.hrm_ps_command_dtls", name: "NewExecPosId", newName: "new_exec_pos_seq");
            //RenameColumn(table: "dbo.hrm_ps_command_dtls", name: "OldDepName", newName: "old_dep_name");
            //RenameColumn(table: "dbo.hrm_ps_command_dtls", name: "OldWorkingDepName", newName: "old_working_dep_name");
            //RenameColumn(table: "dbo.hrm_ps_command_dtls", name: "NewDepName", newName: "new_dep_name");
            //RenameColumn(table: "dbo.hrm_ps_command_dtls", name: "NewWorkingDepName", newName: "new_working_dep_name");
            //RenameColumn(table: "dbo.hrm_ps_command_dtls", name: "PrmBase", newName: "prm_base");
            //RenameColumn(table: "dbo.hrm_ps_command_dtls", name: "PrmPercent", newName: "prm_percent");
            //RenameColumn(table: "dbo.hrm_ps_command_dtls", name: "PrmAmount", newName: "prm_amount");
            //RenameColumn(table: "dbo.hrm_ps_command_dtls", name: "EntNo", newName: "ent_no");
            //RenameColumn(table: "dbo.hrm_ps_command_dtls", name: "EntPosName", newName: "ent_pos_name");
            //RenameColumn(table: "dbo.hrm_ps_command_dtls", name: "EntPosTypeId", newName: "ent_pos_type_seq");
            //RenameColumn(table: "dbo.hrm_ps_command_dtls", name: "EntClassId", newName: "ent_class_seq");
            //RenameColumn(table: "dbo.hrm_ps_command_dtls", name: "EntJobSiteName", newName: "ent_job_site_name");
            //RenameColumn(table: "dbo.hrm_ps_command_dtls", name: "EntDate", newName: "ent_date");
            //RenameColumn(table: "dbo.hrm_ps_command_dtls", name: "BackDate", newName: "back_date");
            //RenameColumn(table: "dbo.hrm_ps_command_dtls", name: "TmpEmpId", newName: "tmp_emp_seq");
            //RenameColumn(table: "dbo.hrm_ps_command_dtls", name: "TmpEduId", newName: "tmp_edu_seq");
            //RenameColumn(table: "dbo.hrm_ps_command_dtls", name: "CurrPosClassDate", newName: "curr_pos_class_date");
            //RenameColumn(table: "dbo.hrm_ps_command_dtls", name: "QuitDate", newName: "quit_date");
            //RenameColumn(table: "dbo.hrm_ps_command_dtls", name: "CurrencyId", newName: "currency_seq");
            //RenameColumn(table: "dbo.hrm_ps_command_dtls", name: "RecordStatus", newName: "record_status");
            //RenameColumn(table: "dbo.hrm_ps_command_dtls", name: "CreatedBy", newName: "created_by");
            //RenameColumn(table: "dbo.hrm_ps_command_dtls", name: "CreatedWhen", newName: "created_when");
            //RenameColumn(table: "dbo.hrm_ps_command_dtls", name: "UpdatedBy", newName: "updated_by");
            //RenameColumn(table: "dbo.hrm_ps_command_dtls", name: "UpdatedWhen", newName: "updated_when");
            //RenameColumn(table: "dbo.hrm_ps_absence", name: "AbsenceId", newName: "absence_seq");
            //RenameColumn(table: "dbo.hrm_ps_absence", name: "AbsenceTypeId", newName: "absence_type_seq");
            //RenameColumn(table: "dbo.hrm_ps_absence", name: "BgYear", newName: "bgm_year");
            //RenameColumn(table: "dbo.hrm_ps_absence", name: "EmpId", newName: "emp_seq");
            //RenameColumn(table: "dbo.hrm_ps_absence", name: "StartDate", newName: "start_date");
            //RenameColumn(table: "dbo.hrm_ps_absence", name: "StartTime", newName: "start_time");
            //RenameColumn(table: "dbo.hrm_ps_absence", name: "EndDate", newName: "end_date");
            //RenameColumn(table: "dbo.hrm_ps_absence", name: "EndTime", newName: "end_time");
            //RenameColumn(table: "dbo.hrm_ps_absence", name: "DayCount", newName: "day_count");
            //RenameColumn(table: "dbo.hrm_ps_absence", name: "ContactAddress", newName: "contact_address");
            //RenameColumn(table: "dbo.hrm_ps_absence", name: "RecordStatus", newName: "record_status");
            //RenameColumn(table: "dbo.hrm_ps_absence", name: "CreatedBy", newName: "created_by");
            //RenameColumn(table: "dbo.hrm_ps_absence", name: "CreatedWhen", newName: "created_when");
            //RenameColumn(table: "dbo.hrm_ps_absence", name: "UpdatedBy", newName: "updated_by");
            //RenameColumn(table: "dbo.hrm_ps_absence", name: "UpdatedWhen", newName: "updated_when");
            //RenameColumn(table: "dbo.hrm_ps_absence_types", name: "AbsenceTypeId", newName: "absence_type_seq");
            //RenameColumn(table: "dbo.hrm_ps_absence_types", name: "AbsenceTypeName", newName: "absence_type_name");
            //RenameColumn(table: "dbo.hrm_ps_absence_types", name: "RecordStatus", newName: "record_status");
            //RenameColumn(table: "dbo.hrm_ps_absence_types", name: "CreatedBy", newName: "created_by");
            //RenameColumn(table: "dbo.hrm_ps_absence_types", name: "CreatedWhen", newName: "created_when");
            //RenameColumn(table: "dbo.hrm_ps_absence_types", name: "UpdatedBy", newName: "updated_by");
            //RenameColumn(table: "dbo.hrm_ps_absence_types", name: "UpdatedWhen", newName: "updated_when");
            //RenameColumn(table: "dbo.hrm_ps_absence_rules", name: "RuleId", newName: "rule_seq");
            //RenameColumn(table: "dbo.hrm_ps_absence_rules", name: "EmpTypeId", newName: "emp_type_seq");
            //RenameColumn(table: "dbo.hrm_ps_absence_rules", name: "AbsenceTypeId", newName: "absence_type_seq");
            //RenameColumn(table: "dbo.hrm_ps_absence_rules", name: "QuotaDay", newName: "quota_day");
            //RenameColumn(table: "dbo.hrm_ps_absence_rules", name: "QuotaSalary", newName: "quota_salary");
            //RenameColumn(table: "dbo.hrm_ps_absence_rules", name: "QuotaCount", newName: "quota_count");
            //RenameColumn(table: "dbo.hrm_ps_absence_rules", name: "QuotaDayCount", newName: "quota_day_count");
            //RenameColumn(table: "dbo.hrm_ps_absence_rules", name: "RecordStatus", newName: "record_status");
            //RenameColumn(table: "dbo.hrm_ps_absence_rules", name: "CreatedBy", newName: "created_by");
            //RenameColumn(table: "dbo.hrm_ps_absence_rules", name: "CreatedWhen", newName: "created_when");
            //RenameColumn(table: "dbo.hrm_ps_absence_rules", name: "UpdatedBy", newName: "updated_by");
            //RenameColumn(table: "dbo.hrm_ps_absence_rules", name: "UpdatedWhen", newName: "updated_when");
            //RenameColumn(table: "dbo.hrm_ps_absence_type_groups", name: "AbsenceTypeGroupId", newName: "absence_type_group_seq");
            //RenameColumn(table: "dbo.hrm_ps_absence_type_groups", name: "AbsenceTypeGroupName", newName: "absence_type_group_name");
            //RenameColumn(table: "dbo.hrm_ps_absence_type_groups", name: "RecordStatus", newName: "record_status");
            //RenameColumn(table: "dbo.hrm_ps_absence_type_groups", name: "CreatedBy", newName: "created_by");
            //RenameColumn(table: "dbo.hrm_ps_absence_type_groups", name: "CreatedWhen", newName: "created_when");
            //RenameColumn(table: "dbo.hrm_ps_absence_type_groups", name: "UpdatedBy", newName: "updated_by");
            //RenameColumn(table: "dbo.hrm_ps_absence_type_groups", name: "UpdatedWhen", newName: "updated_when");
            //RenameColumn(table: "dbo.hrm_ps_commands", name: "HrmPsCommandTypes_CmdTypeId", newName: "cmd_type_seq");
            //RenameColumn(table: "dbo.hrm_ps_commands", name: "HrmPsEmployeeTypes_EmpTypeId", newName: "emp_type_seq");
            //RenameColumn(table: "dbo.hrm_ps_commands", name: "HrmMpJobSites_JobSiteId", newName: "job_site_seq");
            //RenameColumn(table: "dbo.hrm_ps_commands", name: "approver_EmpId", newName: "approver_seq");
            //RenameColumn(table: "dbo.hrm_ps_commands", name: "HrmDcPenalty_PenId", newName: "penalty_seq");

            // how to resolve error
            // 1. add column hrm_ps_commands approver_seq 
            // 2. add column hrm_ps_command_types HrmPsCommandGroups_CmdGroupId
            // 3. rename column in hrm_ps_command_dtls
            //\r\nInvalid column name 'old_HrmMpPositions_PosId'.
            //\r\nInvalid column name 'old_HrmMpClasses_ClassId'.
            //\r\nInvalid column name 'old_HrmMpJobSites_JobSiteId'.
            //\r\nInvalid column name 'old_working_HrmMpJobSites_JobSiteId'.
            //\r\nInvalid column name 'old_HrmMpExecPositions_ExecPosId'.
            //\r\nInvalid column name 'new_HrmMpPositions_PosId'.
            //\r\nInvalid column name 'new_HrmMpClasses_ClassId'.
            //\r\nInvalid column name 'new_HrmMpJobSites_JobSiteId'.
            //\r\nInvalid column name 'new_working_HrmMpJobSites_JobSiteId'.
            //\r\nInvalid column name 'new_HrmMpExecPositions_ExecPosId'

            CreateTable(
                "dbo.rule_absence",
                c => new
                    {
                        rule_absence_seq = c.Int(nullable: false, identity: true),
                        emp_type_seq = c.Int(nullable: false),
                        absence_type_seq = c.Int(nullable: false),
                        send_before = c.Int(),
                        include_nwd = c.String(),
                        day_limit = c.Decimal(precision: 18, scale: 2),
                        day_limit_full_salary = c.Decimal(precision: 18, scale: 2),
                        day_limit_half_salary = c.Decimal(precision: 18, scale: 2),
                        time_limit = c.Decimal(precision: 18, scale: 2),
                        day_per_time_limit = c.Decimal(precision: 18, scale: 2),
                        remarks = c.String(),
                        record_status = c.String(),
                        created_by = c.Int(),
                        created_when = c.DateTime(),
                        updated_by = c.Int(),
                        updated_when = c.DateTime(),
                    })
                .PrimaryKey(t => t.rule_absence_seq);
            
            //CreateTable(
            //    "dbo.hrm_ps_absence_vacations",
            //    c => new
            //        {
            //            vacation_seq = c.Int(nullable: false, identity: true),
            //            vacation_year = c.Int(),
            //            emp_seq = c.Int(),
            //            vacation_add = c.Decimal(precision: 18, scale: 2),
            //            in_balance = c.Decimal(precision: 18, scale: 2),
            //            out_balance = c.Decimal(precision: 18, scale: 2),
            //            record_status = c.String(),
            //            created_by = c.Int(),
            //            created_when = c.DateTime(),
            //            updated_by = c.Int(),
            //            updated_when = c.DateTime(),
            //        })
            //    .PrimaryKey(t => t.vacation_seq)
            //    .ForeignKey("dbo.hrm_ps_employees", t => t.emp_seq)
            //    .Index(t => t.emp_seq);
            
            CreateTable(
                "dbo.salary_promote",
                c => new
                    {
                        sp_seq = c.Int(nullable: false, identity: true),
                        sp_cmd_title = c.String(),
                        effected_date = c.DateTime(),
                        remarks = c.String(),
                        record_status = c.String(),
                        created_by = c.Int(),
                        created_when = c.DateTime(),
                        updated_by = c.Int(),
                        updated_when = c.DateTime(),
                    })
                .PrimaryKey(t => t.sp_seq);
            
            CreateTable(
                "dbo.salary_promote_detail",
                c => new
                    {
                        spd_seq = c.Int(nullable: false, identity: true),
                        sp_seq = c.Int(nullable: false),
                        pos_seq = c.Int(nullable: false),
                        emp_seq = c.Int(nullable: false),
                        old_salary = c.Decimal(nullable: false, precision: 18, scale: 2),
                        new_salary = c.Decimal(nullable: false, precision: 18, scale: 2),
                    })
                .PrimaryKey(t => t.spd_seq)
                .ForeignKey("dbo.hrm_mp_positions", t => t.pos_seq, cascadeDelete: true)
                .ForeignKey("dbo.hrm_ps_employees", t => t.emp_seq, cascadeDelete: true)
                .ForeignKey("dbo.salary_promote", t => t.sp_seq, cascadeDelete: true)
                .Index(t => t.pos_seq)
                .Index(t => t.emp_seq)
                .Index(t => t.sp_seq);
            
            AddColumn("dbo.SysApprovalTask", "Completed", c => c.Boolean(nullable: false));
            AddColumn("dbo.SysApprovalTask", "CompletedActionBy", c => c.Int());
            AddColumn("dbo.SysApprovalTask", "CompletedActionWhen", c => c.DateTime());
            AddColumn("dbo.SysApprovalTask", "CompletedDtlId", c => c.Int());
            AddColumn("dbo.SysApprovalTask", "CompletedMessageId", c => c.Int());
            AddColumn("dbo.SysApprovalTask", "CompletedCommandAction", c => c.String());
            AddColumn("dbo.hrm_ps_absence", "time_count", c => c.Decimal(precision: 18, scale: 2));
            //AddColumn("dbo.hrm_ps_absence", "request_title", c => c.String());
            //AlterColumn("dbo.message_warning", "remarks", c => c.String());
            AlterColumn("dbo.hrm_ps_commands", "confirm", c => c.Int());
            AlterColumn("dbo.hrm_ps_commands", "remarks", c => c.String());
            //AlterColumn("dbo.hrm_ps_command_types", "remarks", c => c.String());
            //AlterColumn("dbo.hrm_ps_command_dtls", "remarks", c => c.String());
            //AlterColumn("dbo.hrm_ps_command_dtls", "remarks2", c => c.String());
            //AlterColumn("dbo.hrm_ps_absence", "remarks", c => c.String());
            //AlterColumn("dbo.hrm_ps_absence", "description", c => c.String());
            //AlterColumn("dbo.hrm_ps_absence_types", "remarks", c => c.String());
            //AlterColumn("dbo.hrm_ps_absence_rules", "remarks", c => c.String());
            //AlterColumn("dbo.hrm_ps_absence_type_groups", "remarks", c => c.String());
            //DropColumn("dbo.hrm_ps_commands", "ApprovedId");
            DropTable("dbo.HrmPsEmployeeType");
        }
        
        public override void Down()
        {
            CreateTable(
                "dbo.HrmPsEmployeeType",
                c => new
                    {
                        EmpTypeId = c.Int(nullable: false, identity: true),
                        EmpTypeName = c.String(),
                        SalaryUpTime = c.Int(),
                        Retirements = c.Int(),
                        Royalitems = c.Int(),
                        YearTypeId = c.Int(),
                        Remarks = c.String(),
                        RecordStatus = c.String(),
                        CreatedBy = c.Int(),
                        CreatedWhen = c.DateTime(),
                        UpdatedBy = c.Int(),
                        UpdatedWhen = c.DateTime(),
                    })
                .PrimaryKey(t => t.EmpTypeId);
            
            AddColumn("dbo.hrm_ps_commands", "ApprovedId", c => c.Int());
            DropIndex("dbo.salary_promote_detail", new[] { "sp_seq" });
            DropIndex("dbo.salary_promote_detail", new[] { "emp_seq" });
            DropIndex("dbo.salary_promote_detail", new[] { "pos_seq" });
            DropIndex("dbo.hrm_ps_absence_vacations", new[] { "emp_seq" });
            DropForeignKey("dbo.salary_promote_detail", "sp_seq", "dbo.salary_promote");
            DropForeignKey("dbo.salary_promote_detail", "emp_seq", "dbo.hrm_ps_employees");
            DropForeignKey("dbo.salary_promote_detail", "pos_seq", "dbo.hrm_mp_positions");
            DropForeignKey("dbo.hrm_ps_absence_vacations", "emp_seq", "dbo.hrm_ps_employees");
            AlterColumn("dbo.hrm_ps_absence_type_groups", "Remarks", c => c.String());
            AlterColumn("dbo.hrm_ps_absence_rules", "Remarks", c => c.String());
            AlterColumn("dbo.hrm_ps_absence_types", "Remarks", c => c.String());
            AlterColumn("dbo.hrm_ps_absence", "Description", c => c.String());
            AlterColumn("dbo.hrm_ps_absence", "Remarks", c => c.String());
            AlterColumn("dbo.hrm_ps_command_dtls", "Remarks2", c => c.String());
            AlterColumn("dbo.hrm_ps_command_dtls", "Remarks", c => c.String());
            AlterColumn("dbo.hrm_ps_command_types", "Remarks", c => c.String());
            AlterColumn("dbo.hrm_ps_commands", "Remarks", c => c.String());
            AlterColumn("dbo.hrm_ps_commands", "Confirm", c => c.Int());
            AlterColumn("dbo.message_warning", "Remarks", c => c.String());
            DropColumn("dbo.hrm_ps_absence", "request_title");
            DropColumn("dbo.hrm_ps_absence", "time_count");
            DropColumn("dbo.SysApprovalTask", "CompletedCommandAction");
            DropColumn("dbo.SysApprovalTask", "CompletedMessageId");
            DropColumn("dbo.SysApprovalTask", "CompletedDtlId");
            DropColumn("dbo.SysApprovalTask", "CompletedActionWhen");
            DropColumn("dbo.SysApprovalTask", "CompletedActionBy");
            DropColumn("dbo.SysApprovalTask", "Completed");
            DropTable("dbo.salary_promote_detail");
            DropTable("dbo.salary_promote");
            DropTable("dbo.hrm_ps_absence_vacations");
            DropTable("dbo.rule_absence");
            RenameColumn(table: "dbo.hrm_ps_commands", name: "penalty_seq", newName: "HrmDcPenalty_PenId");
            RenameColumn(table: "dbo.hrm_ps_commands", name: "approver_seq", newName: "approver_EmpId");
            RenameColumn(table: "dbo.hrm_ps_commands", name: "job_site_seq", newName: "HrmMpJobSites_JobSiteId");
            RenameColumn(table: "dbo.hrm_ps_commands", name: "emp_type_seq", newName: "HrmPsEmployeeTypes_EmpTypeId");
            RenameColumn(table: "dbo.hrm_ps_commands", name: "cmd_type_seq", newName: "HrmPsCommandTypes_CmdTypeId");
            RenameColumn(table: "dbo.hrm_ps_absence_type_groups", name: "updated_when", newName: "UpdatedWhen");
            RenameColumn(table: "dbo.hrm_ps_absence_type_groups", name: "updated_by", newName: "UpdatedBy");
            RenameColumn(table: "dbo.hrm_ps_absence_type_groups", name: "created_when", newName: "CreatedWhen");
            RenameColumn(table: "dbo.hrm_ps_absence_type_groups", name: "created_by", newName: "CreatedBy");
            RenameColumn(table: "dbo.hrm_ps_absence_type_groups", name: "record_status", newName: "RecordStatus");
            RenameColumn(table: "dbo.hrm_ps_absence_type_groups", name: "absence_type_group_name", newName: "AbsenceTypeGroupName");
            RenameColumn(table: "dbo.hrm_ps_absence_type_groups", name: "absence_type_group_seq", newName: "AbsenceTypeGroupId");
            RenameColumn(table: "dbo.hrm_ps_absence_rules", name: "updated_when", newName: "UpdatedWhen");
            RenameColumn(table: "dbo.hrm_ps_absence_rules", name: "updated_by", newName: "UpdatedBy");
            RenameColumn(table: "dbo.hrm_ps_absence_rules", name: "created_when", newName: "CreatedWhen");
            RenameColumn(table: "dbo.hrm_ps_absence_rules", name: "created_by", newName: "CreatedBy");
            RenameColumn(table: "dbo.hrm_ps_absence_rules", name: "record_status", newName: "RecordStatus");
            RenameColumn(table: "dbo.hrm_ps_absence_rules", name: "quota_day_count", newName: "QuotaDayCount");
            RenameColumn(table: "dbo.hrm_ps_absence_rules", name: "quota_count", newName: "QuotaCount");
            RenameColumn(table: "dbo.hrm_ps_absence_rules", name: "quota_salary", newName: "QuotaSalary");
            RenameColumn(table: "dbo.hrm_ps_absence_rules", name: "quota_day", newName: "QuotaDay");
            RenameColumn(table: "dbo.hrm_ps_absence_rules", name: "absence_type_seq", newName: "AbsenceTypeId");
            RenameColumn(table: "dbo.hrm_ps_absence_rules", name: "emp_type_seq", newName: "EmpTypeId");
            RenameColumn(table: "dbo.hrm_ps_absence_rules", name: "rule_seq", newName: "RuleId");
            RenameColumn(table: "dbo.hrm_ps_absence_types", name: "updated_when", newName: "UpdatedWhen");
            RenameColumn(table: "dbo.hrm_ps_absence_types", name: "updated_by", newName: "UpdatedBy");
            RenameColumn(table: "dbo.hrm_ps_absence_types", name: "created_when", newName: "CreatedWhen");
            RenameColumn(table: "dbo.hrm_ps_absence_types", name: "created_by", newName: "CreatedBy");
            RenameColumn(table: "dbo.hrm_ps_absence_types", name: "record_status", newName: "RecordStatus");
            RenameColumn(table: "dbo.hrm_ps_absence_types", name: "absence_type_name", newName: "AbsenceTypeName");
            RenameColumn(table: "dbo.hrm_ps_absence_types", name: "absence_type_seq", newName: "AbsenceTypeId");
            RenameColumn(table: "dbo.hrm_ps_absence", name: "updated_when", newName: "UpdatedWhen");
            RenameColumn(table: "dbo.hrm_ps_absence", name: "updated_by", newName: "UpdatedBy");
            RenameColumn(table: "dbo.hrm_ps_absence", name: "created_when", newName: "CreatedWhen");
            RenameColumn(table: "dbo.hrm_ps_absence", name: "created_by", newName: "CreatedBy");
            RenameColumn(table: "dbo.hrm_ps_absence", name: "record_status", newName: "RecordStatus");
            RenameColumn(table: "dbo.hrm_ps_absence", name: "contact_address", newName: "ContactAddress");
            RenameColumn(table: "dbo.hrm_ps_absence", name: "day_count", newName: "DayCount");
            RenameColumn(table: "dbo.hrm_ps_absence", name: "end_time", newName: "EndTime");
            RenameColumn(table: "dbo.hrm_ps_absence", name: "end_date", newName: "EndDate");
            RenameColumn(table: "dbo.hrm_ps_absence", name: "start_time", newName: "StartTime");
            RenameColumn(table: "dbo.hrm_ps_absence", name: "start_date", newName: "StartDate");
            RenameColumn(table: "dbo.hrm_ps_absence", name: "emp_seq", newName: "EmpId");
            RenameColumn(table: "dbo.hrm_ps_absence", name: "bgm_year", newName: "BgYear");
            RenameColumn(table: "dbo.hrm_ps_absence", name: "absence_type_seq", newName: "AbsenceTypeId");
            RenameColumn(table: "dbo.hrm_ps_absence", name: "absence_seq", newName: "AbsenceId");
            RenameColumn(table: "dbo.hrm_ps_command_dtls", name: "updated_when", newName: "UpdatedWhen");
            RenameColumn(table: "dbo.hrm_ps_command_dtls", name: "updated_by", newName: "UpdatedBy");
            RenameColumn(table: "dbo.hrm_ps_command_dtls", name: "created_when", newName: "CreatedWhen");
            RenameColumn(table: "dbo.hrm_ps_command_dtls", name: "created_by", newName: "CreatedBy");
            RenameColumn(table: "dbo.hrm_ps_command_dtls", name: "record_status", newName: "RecordStatus");
            RenameColumn(table: "dbo.hrm_ps_command_dtls", name: "currency_seq", newName: "CurrencyId");
            RenameColumn(table: "dbo.hrm_ps_command_dtls", name: "quit_date", newName: "QuitDate");
            RenameColumn(table: "dbo.hrm_ps_command_dtls", name: "curr_pos_class_date", newName: "CurrPosClassDate");
            RenameColumn(table: "dbo.hrm_ps_command_dtls", name: "tmp_edu_seq", newName: "TmpEduId");
            RenameColumn(table: "dbo.hrm_ps_command_dtls", name: "tmp_emp_seq", newName: "TmpEmpId");
            RenameColumn(table: "dbo.hrm_ps_command_dtls", name: "back_date", newName: "BackDate");
            RenameColumn(table: "dbo.hrm_ps_command_dtls", name: "ent_date", newName: "EntDate");
            RenameColumn(table: "dbo.hrm_ps_command_dtls", name: "ent_job_site_name", newName: "EntJobSiteName");
            RenameColumn(table: "dbo.hrm_ps_command_dtls", name: "ent_class_seq", newName: "EntClassId");
            RenameColumn(table: "dbo.hrm_ps_command_dtls", name: "ent_pos_type_seq", newName: "EntPosTypeId");
            RenameColumn(table: "dbo.hrm_ps_command_dtls", name: "ent_pos_name", newName: "EntPosName");
            RenameColumn(table: "dbo.hrm_ps_command_dtls", name: "ent_no", newName: "EntNo");
            RenameColumn(table: "dbo.hrm_ps_command_dtls", name: "prm_amount", newName: "PrmAmount");
            RenameColumn(table: "dbo.hrm_ps_command_dtls", name: "prm_percent", newName: "PrmPercent");
            RenameColumn(table: "dbo.hrm_ps_command_dtls", name: "prm_base", newName: "PrmBase");
            RenameColumn(table: "dbo.hrm_ps_command_dtls", name: "new_working_dep_name", newName: "NewWorkingDepName");
            RenameColumn(table: "dbo.hrm_ps_command_dtls", name: "new_dep_name", newName: "NewDepName");
            RenameColumn(table: "dbo.hrm_ps_command_dtls", name: "old_working_dep_name", newName: "OldWorkingDepName");
            RenameColumn(table: "dbo.hrm_ps_command_dtls", name: "old_dep_name", newName: "OldDepName");
            RenameColumn(table: "dbo.hrm_ps_command_dtls", name: "new_exec_pos_seq", newName: "NewExecPosId");
            RenameColumn(table: "dbo.hrm_ps_command_dtls", name: "new_pos_type_seq", newName: "NewPosTypeId");
            RenameColumn(table: "dbo.hrm_ps_command_dtls", name: "new_pos_line", newName: "NewPosLine");
            RenameColumn(table: "dbo.hrm_ps_command_dtls", name: "new_exec_salary", newName: "NewExecSalary");
            RenameColumn(table: "dbo.hrm_ps_command_dtls", name: "new_salary", newName: "NewSalary");
            RenameColumn(table: "dbo.hrm_ps_command_dtls", name: "new_working_job_site_name", newName: "NewWorkingJobSiteName");
            RenameColumn(table: "dbo.hrm_ps_command_dtls", name: "new_working_job_site_seq", newName: "NewWorkingJobSiteId");
            RenameColumn(table: "dbo.hrm_ps_command_dtls", name: "new_job_site_name", newName: "NewJobSiteName");
            RenameColumn(table: "dbo.hrm_ps_command_dtls", name: "new_job_site_seq", newName: "NewJobSiteId");
            RenameColumn(table: "dbo.hrm_ps_command_dtls", name: "new_class_seq", newName: "NewClassId");
            RenameColumn(table: "dbo.hrm_ps_command_dtls", name: "new_exec_pos_name", newName: "NewExecPosName");
            RenameColumn(table: "dbo.hrm_ps_command_dtls", name: "new_pos_name", newName: "NewPosName");
            RenameColumn(table: "dbo.hrm_ps_command_dtls", name: "new_pos_ref", newName: "NewPosRef");
            RenameColumn(table: "dbo.hrm_ps_command_dtls", name: "new_pos_seq", newName: "NewPosId");
            RenameColumn(table: "dbo.hrm_ps_command_dtls", name: "old_exec_pos_seq", newName: "OldExecPosId");
            RenameColumn(table: "dbo.hrm_ps_command_dtls", name: "old_pos_type_seq", newName: "OldPosTypeId");
            RenameColumn(table: "dbo.hrm_ps_command_dtls", name: "old_pos_line", newName: "OldPosLine");
            RenameColumn(table: "dbo.hrm_ps_command_dtls", name: "old_exec_salary", newName: "OldExecSalary");
            RenameColumn(table: "dbo.hrm_ps_command_dtls", name: "old_salary", newName: "OldSalary");
            RenameColumn(table: "dbo.hrm_ps_command_dtls", name: "old_working_job_site_name", newName: "OldWorkingJobSiteName");
            RenameColumn(table: "dbo.hrm_ps_command_dtls", name: "old_working_job_site_seq", newName: "OldWorkingJobSiteId");
            RenameColumn(table: "dbo.hrm_ps_command_dtls", name: "old_job_site_name", newName: "OldJobSiteName");
            RenameColumn(table: "dbo.hrm_ps_command_dtls", name: "old_job_site_seq", newName: "OldJobSiteId");
            RenameColumn(table: "dbo.hrm_ps_command_dtls", name: "old_class_seq", newName: "OldClassId");
            RenameColumn(table: "dbo.hrm_ps_command_dtls", name: "old_exec_pos_name", newName: "OldExecPosName");
            RenameColumn(table: "dbo.hrm_ps_command_dtls", name: "old_pos_name", newName: "OldPosName");
            RenameColumn(table: "dbo.hrm_ps_command_dtls", name: "old_pos_ref", newName: "OldPosRef");
            RenameColumn(table: "dbo.hrm_ps_command_dtls", name: "old_pos_seq", newName: "OldPosId");
            RenameColumn(table: "dbo.hrm_ps_command_dtls", name: "move_seq", newName: "MoveId");
            RenameColumn(table: "dbo.hrm_ps_command_dtls", name: "rpt_remarks", newName: "RptRemarks");
            RenameColumn(table: "dbo.hrm_ps_command_dtls", name: "edu_his_seq", newName: "EduHisId");
            RenameColumn(table: "dbo.hrm_ps_command_dtls", name: "end_date", newName: "EndDate");
            RenameColumn(table: "dbo.hrm_ps_command_dtls", name: "start_date", newName: "StartDate");
            RenameColumn(table: "dbo.hrm_ps_command_dtls", name: "emp_seq", newName: "EmpId");
            RenameColumn(table: "dbo.hrm_ps_command_dtls", name: "cmd_seq", newName: "CmdId");
            RenameColumn(table: "dbo.hrm_ps_command_dtls", name: "cmd_dtls_seq", newName: "CmdDtlsId");
            RenameColumn(table: "dbo.hrm_dc_penalty", name: "updated_when", newName: "UpdatedWhen");
            RenameColumn(table: "dbo.hrm_dc_penalty", name: "updated_by", newName: "UpdatedBy");
            RenameColumn(table: "dbo.hrm_dc_penalty", name: "created_when", newName: "CreatedWhen");
            RenameColumn(table: "dbo.hrm_dc_penalty", name: "created_by", newName: "CreatedBy");
            RenameColumn(table: "dbo.hrm_dc_penalty", name: "record_status", newName: "RecordStatus");
            RenameColumn(table: "dbo.hrm_dc_penalty", name: "pen_name", newName: "PenName");
            RenameColumn(table: "dbo.hrm_dc_penalty", name: "pen_seq", newName: "PenId");
            RenameColumn(table: "dbo.hrm_ps_command_groups", name: "updated_when", newName: "UpdatedWhen");
            RenameColumn(table: "dbo.hrm_ps_command_groups", name: "updated_by", newName: "UpdatedBy");
            RenameColumn(table: "dbo.hrm_ps_command_groups", name: "created_when", newName: "CreatedWhen");
            RenameColumn(table: "dbo.hrm_ps_command_groups", name: "created_by", newName: "CreatedBy");
            RenameColumn(table: "dbo.hrm_ps_command_groups", name: "record_status", newName: "RecordStatus");
            RenameColumn(table: "dbo.hrm_ps_command_groups", name: "cmd_group_name", newName: "CmdGroupName");
            RenameColumn(table: "dbo.hrm_ps_command_groups", name: "cmd_group_seq", newName: "CmdGroupId");
            RenameColumn(table: "dbo.hrm_ps_command_types", name: "rpt_header", newName: "RptHeader");
            RenameColumn(table: "dbo.hrm_ps_command_types", name: "updated_when", newName: "UpdatedWhen");
            RenameColumn(table: "dbo.hrm_ps_command_types", name: "updated_by", newName: "UpdatedBy");
            RenameColumn(table: "dbo.hrm_ps_command_types", name: "created_when", newName: "CreatedWhen");
            RenameColumn(table: "dbo.hrm_ps_command_types", name: "created_by", newName: "CreatedBy");
            RenameColumn(table: "dbo.hrm_ps_command_types", name: "record_status", newName: "RecordStatus");
            RenameColumn(table: "dbo.hrm_ps_command_types", name: "rpt_format", newName: "RptFormat");
            RenameColumn(table: "dbo.hrm_ps_command_types", name: "cmd_group_seq", newName: "CmdGroupId");
            RenameColumn(table: "dbo.hrm_ps_command_types", name: "cmd_type_name_short", newName: "CmdTypeNameShort");
            RenameColumn(table: "dbo.hrm_ps_command_types", name: "cmd_type_name", newName: "CmdTypeName");
            RenameColumn(table: "dbo.hrm_ps_command_types", name: "cmd_type_code", newName: "CmdTypeCode");
            RenameColumn(table: "dbo.hrm_ps_command_types", name: "cmd_type_seq", newName: "CmdTypeId");
            RenameColumn(table: "dbo.hrm_ps_commands", name: "updated_when", newName: "UpdatedWhen");
            RenameColumn(table: "dbo.hrm_ps_commands", name: "updated_by", newName: "UpdatedBy");
            RenameColumn(table: "dbo.hrm_ps_commands", name: "created_when", newName: "CreatedWhen");
            RenameColumn(table: "dbo.hrm_ps_commands", name: "created_by", newName: "CreatedBy");
            RenameColumn(table: "dbo.hrm_ps_commands", name: "record_status", newName: "RecordStatus");
            RenameColumn(table: "dbo.hrm_ps_commands", name: "rpt_header", newName: "RptHeader");
            RenameColumn(table: "dbo.hrm_ps_commands", name: "cmd_rpt_date", newName: "CmdRptDate");
            RenameColumn(table: "dbo.hrm_ps_commands", name: "approved_date", newName: "ApprovedDate");
            RenameColumn(table: "dbo.hrm_ps_commands", name: "approved_positions", newName: "ApprovedPositions");
            RenameColumn(table: "dbo.hrm_ps_commands", name: "approved_name", newName: "ApprovedName");
            RenameColumn(table: "dbo.hrm_ps_commands", name: "cmd_status", newName: "CmdStatus");
            RenameColumn(table: "dbo.hrm_ps_commands", name: "penalty_seq", newName: "PenaltyId");
            RenameColumn(table: "dbo.hrm_ps_commands", name: "job_site_seq", newName: "JobSiteId");
            RenameColumn(table: "dbo.hrm_ps_commands", name: "emp_type_seq", newName: "EmpTypeId");
            RenameColumn(table: "dbo.hrm_ps_commands", name: "cmd_type_seq", newName: "CmdTypeId");
            RenameColumn(table: "dbo.hrm_ps_commands", name: "cmd_ref_no", newName: "CmdRefNo");
            RenameColumn(table: "dbo.hrm_ps_commands", name: "cmd_descr", newName: "CmdDescr");
            RenameColumn(table: "dbo.hrm_ps_commands", name: "cmd_name", newName: "CmdName");
            RenameColumn(table: "dbo.hrm_ps_commands", name: "cmd_draft_no", newName: "CmdDraftNo");
            RenameColumn(table: "dbo.hrm_ps_commands", name: "cmd_flag", newName: "CmdFlag");
            RenameColumn(table: "dbo.hrm_ps_commands", name: "cmd_seq", newName: "CmdId");
            RenameColumn(table: "dbo.message_warning", name: "updated_when", newName: "UpdatedWhen");
            RenameColumn(table: "dbo.message_warning", name: "updated_by", newName: "UpdatedBy");
            RenameColumn(table: "dbo.message_warning", name: "created_when", newName: "CreatedWhen");
            RenameColumn(table: "dbo.message_warning", name: "created_by", newName: "CreatedBy");
            RenameColumn(table: "dbo.message_warning", name: "record_status", newName: "RecordStatus");
            RenameColumn(table: "dbo.message_warning", name: "message_type", newName: "MessageType");
            RenameColumn(table: "dbo.message_warning", name: "message_en", newName: "MessageEn");
            RenameColumn(table: "dbo.message_warning", name: "message_th", newName: "MessageTh");
            RenameColumn(table: "dbo.message_warning", name: "message_seq", newName: "MessageId");
            CreateIndex("dbo.HrmPsEmployeeType", "YearTypeId");
            CreateIndex("dbo.HrmPsCommand", "ApprovedId");
            CreateIndex("dbo.HrmPsCommand", "HrmPsEmployeeTypes_EmpTypeId");
            CreateIndex("dbo.HrmPsCommand", "HrmPsCommandTypes_CmdTypeId");
            AddForeignKey("dbo.HrmPsEmployeeType", "YearTypeId", "dbo.sys_year_type", "year_type_seq");
            AddForeignKey("dbo.HrmPsCommand", "ApprovedId", "dbo.HrmPsCommand", "CmdId");
            AddForeignKey("dbo.HrmPsCommand", "HrmPsEmployeeTypes_EmpTypeId", "dbo.hrm_ps_employee_types", "emp_type_seq");
            AddForeignKey("dbo.HrmPsCommand", "HrmPsCommandTypes_CmdTypeId", "dbo.HrmPsCommandType", "CmdTypeId");
            RenameTable(name: "dbo.hrm_ps_absence_type_groups", newName: "HrmPsAbsenceTypeGroup");
            RenameTable(name: "dbo.hrm_ps_absence_rules", newName: "HrmPsAbsenceRule");
            RenameTable(name: "dbo.hrm_ps_absence_types", newName: "HrmPsAbsenceType");
            RenameTable(name: "dbo.hrm_ps_absence", newName: "HrmPsAbsence");
            RenameTable(name: "dbo.hrm_ps_command_dtls", newName: "HrmPsCommandDtls");
            RenameTable(name: "dbo.hrm_dc_penalty", newName: "HrmDcPenalty");
            RenameTable(name: "dbo.hrm_ps_command_groups", newName: "HrmPsCommandGroup");
            RenameTable(name: "dbo.hrm_ps_command_types", newName: "HrmPsCommandType");
            RenameTable(name: "dbo.hrm_ps_commands", newName: "HrmPsCommand");
            RenameTable(name: "dbo.message_warning", newName: "MessageWarning");
        }
    }
}
